﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Outdoors.ViewModels
{
    public class ActivityItemViewModel : INotifyPropertyChanged
    {
        private string _name;
        public string Name
        {

            get
            {
                return _name;
            }
            set
            {
                if (value != _name)
                {
                    _name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }
        private int _numberOfVenues;
        public int NumberOfVenues
        {

            get
            {
                return _numberOfVenues;
            }
            set
            {
                if (value != _numberOfVenues)
                {
                    _numberOfVenues = value;
                    NotifyPropertyChanged("NumberOfVenues");
                }
            }
        }
        private ActivityType _type;
        public ActivityType Type
        {
            get
            {
                return _type;
            }
            set
            {
                if (value != _type)
                {
                    _type = value;
                    NotifyPropertyChanged("Type");
                }
            }
        }

        private List<ActivityCategory> _categories;
        public List<ActivityCategory> Categories
        {
            get
            {
                return _categories;
            }
            set
            {
                if (value != _categories)
                {
                    _categories = value;
                    NotifyPropertyChanged("Categories");
                }
            }
        }

        private string _categoryId;
        public string CategoryId
        {
            get
            {
                return _categoryId;
            }
            set
            {
                if (value != _categoryId)
                {
                    _categoryId = value;
                    NotifyPropertyChanged("CategoryId");
                }
            }
        }
        public ActivityItemViewModel() { }

        public ActivityItemViewModel(string name, ActivityType type, List<ActivityCategory> categories, string categoryId)
        {
            Name = name;
            Type = type;
            Categories = categories;
            CategoryId = categoryId;
        }

        public ActivityItemViewModel(string name, ActivityType type, List<ActivityCategory> categories, string categoryId,int numberOfVenues)
        {
            Name = name;
            Type = type;
            Categories = categories;
            CategoryId = categoryId;
            NumberOfVenues = numberOfVenues;
        }

        public event PropertyChangedEventHandler PropertyChanged;
         private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
    public enum ActivityType
    {
        Summer,
        Winter
    }

    public class ActivityCategory
    {
        public string Name { get; set; }
        public string CategoryId { get; set; }
        public ActivityCategory(string name, string categoryId)
        {
            Name = name;
            CategoryId = categoryId;
        }
    }
}
